﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SqlClient;

namespace 花店管理系统.geren
{
    public partial class gonggao : Form
    {
        public gonggao()
        {
            InitializeComponent();
        }
        public static int Gongaoid;
        void showAll()
        {
            DB.GetCn();
            string str = "select * from T_gongao";
            SqlCommand cmd = new SqlCommand(str, DB.cn);
            SqlDataReader rdr = cmd.ExecuteReader();
            while(rdr.Read())
            {
                int index = dgvGonggao.Rows.Add();
                dgvGonggao.Rows[index].Cells[0].Value = rdr[0];
                dgvGonggao.Rows[index].Cells[1].Value = rdr[1];
                dgvGonggao.Rows[index].Cells[2].Value = rdr[2];
                dgvGonggao.Rows[index].Cells[3].Value = rdr[3];
            }
            rdr.Close();
        }

        private void gonggao_Load(object sender, EventArgs e)
        {
            showAll();
        }

        private void btnCanel_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void dgvGonggao_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {

            int CIndex = e.ColumnIndex;
            if (CIndex == 4)
            {
                int rowindex = e.RowIndex;
                //MessageBox.Show(dgvGonggao.Rows[rowindex].Cells[0].Value.ToString());
                gonggao.Gongaoid = int.Parse(dgvGonggao.Rows[rowindex].Cells[0].Value.ToString());
                geren.Xiangxixinxi xi = new geren.Xiangxixinxi();
                xi.ShowDialog();
            }
        
        }
    }
}
